package com.rainman.simpleredis.demo.controller;

import com.rainman.simpleredis.core.SimpleRedis;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * 测试MQ消息
 * 串行与并行
 *
 */
@RestController
@RequestMapping("/realMq")
public class DemoRealMqController {

    @Autowired
    SimpleRedis simpleRedis;

    @Autowired
    StringRedisTemplate stringRedisTemplate;


    @RequestMapping("/para")
    public String para(Long id ){


        simpleRedis.publishOnePara("200",id+1+"","看看可否2223");
        simpleRedis.publishOnePara("200",id+2+"","看看可否2223");
        simpleRedis.publishOnePara("200",id+3+"","看看可否2223");
        System.out.println("成产者触发时间"+System.currentTimeMillis());
        return "";
    }

    @RequestMapping("/seri")
    public String seri(Long id ){

        simpleRedis.publishOne("200",id+1+"","看看可否222311");
        simpleRedis.publishOne("200",id+2+"","看看可否222311");
        simpleRedis.publishOne("200",id+3+"","看看可否222311");
        System.out.println("成产者触发时间"+System.currentTimeMillis());
        return "";
    }



}
